<?php
if (!isset ($_GET["file"])) $file = ""; else $file = $_GET["file"];
$file = $file.".pdf";
$file_patch = "lib/".$file;
if (!file_exists ($file_patch))
{
    echo "File not exists!".$file_patch;
    exit;
}
else
{
    $file_size = filesize ($file_patch);
    $fp = fopen ($file_patch, "r");
    header ("Content-Type: octet/bin");
    header ("Content-Disposition: attachment; filename=$file");
    header ("Content-Length: $file_size");
    fpassthru ($fp);
    fclose ($fp);
}
?>
